<template>
  <a-form
    ref="form"
    :rules="rules"
    :model="formData"
    :label-col="{ span: 5 }"
    :wrapper-col="{ span: 18 }"
    style="padding: 20px"
  >
    <a-form-item label="处理时间" name="handle_time">
      <a-date-picker
        style="width: 100%"
        show-time
        placeholder="请选择处理时间"
        v-model:value="formData.handle_time"
        value-format="YYYY-MM-DD HH:mm:ss"
    /></a-form-item>
    <a-form-item label="处理人员" name="handle_people_name">
      <a-input v-model:value="formData.handle_people_name" placeholder="请输入处理人员姓名" />
    </a-form-item>
    <a-form-item label="处理人电话" name="handle_people_phone">
      <a-input v-model:value="formData.handle_people_phone" placeholder="请输入处理人员电话" />
    </a-form-item>
    <a-form-item label="处理结果" name="handle_result">
      <a-input type="textarea" v-model:value="formData.handle_result" placeholder="请输入处理结果" />
    </a-form-item>
    <!--      <a-form-item label="处罚结果">
      <a-input type="textarea" v-model:value="formData.punishment_result" placeholder="请输入处罚结果" />
    </a-form-item>-->
  </a-form>
</template>

<script>
import { handleFormRes } from '@gis/lib/utils/resolver.js';
import { allAlarmHandle } from '@gis/lib/api/index.js';

export default {
  name: 'warning-handle',
  props: {
    id: { type: [String, Number], default: '' },
  },
  data() {
    return {
      rules: {
        handle_time: { required: true, message: '请选择处理时间' },
        handle_people_name: { required: true, message: '请输入处理人员姓名' },
        handle_result: { required: true, message: '请输入处理结果' },
      },
      formData: {
        handle_time: null,
        handle_people_name: '',
        handle_people_phone: '',
        handle_result: '',
      },
    };
  },
  methods: {
    async onOk() {
      const valid = await this.$refs.form.validate();
      if (!valid) return;
      let paramsData = Object.assign({}, this.formData, { id: this.id });
      return await handleFormRes(await allAlarmHandle(paramsData));
    },
  },
};
</script>

<style scoped lang="less">
.warning-handle {
}
</style>
